﻿/**

 * Copyright (c) 2015-2017, FastDev 刘强 (fastdev@163.com).

 *

 * Licensed under the Apache License, Version 2.0 (the "License");

 * you may not use this file except in compliance with the License.

 * You may obtain a copy of the License at

 *

 *      http://www.apache.org/licenses/LICENSE-2.0

 *

 * Unless required by applicable law or agreed to in writing, software

 * distributed under the License is distributed on an "AS IS" BASIS,

 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

 * See the License for the specific language governing permissions and

 * limitations under the License.

 */


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace TestConsole
{


    public class TestsWrap : TestsBase
    {
        public override void Run()
        {
            Safe(() => Console.WriteLine(RunWrapStatGenFuncStatGenReplace<int, string>(123)));
            Safe(() => RunInjectWrapEvents(new TestEntity { Id = 2 }));
            Safe(() => RunWrapStatGenActionStatGenReplace<TestEntity>(new TestEntity { Id = 3 }));
            Safe(() => new TestsWrap().RunWrapInstActionInstReplace(new TestEntity { Id = 4 }));
            Safe(() => new TestsWrap().RunWrapInstGenActionInstGenReplace<string>("param"));
            Safe(() => Console.WriteLine(new TestsWrap().RunWrapInstFuncInstReplace(new TestEntity { Id = 5 })));
            Safe(() => Console.WriteLine("RunWrapStatFuncStatReplace:" + RunWrapStatFuncStatReplace(new TestEntity { Id = 6 })));
            Safe(() => Console.WriteLine(new TestsWrap().RunGetMulParam(1, 2, "3", 4, 5, 6)));
            Safe(() => Console.WriteLine(new TestsWrap().RunWrapInstGenFuncInstGenReplace<TestEntity, string>(new TestEntity { Id = 7 })));
        }

        public static outT RunWrapStatGenFuncStatGenReplace<InT, outT>(InT t2)
        {
            Console.WriteLine("in RunWrapStatGenFuncStatGenReplace!" + t2.ToString());
            return default(outT);
        }

        public static void RunInjectWrapEvents(TestEntity t2)
        {
            Console.WriteLine("in RunInjectWrapEvents!" + t2.Id);
        }

        public static void RunWrapStatGenActionStatGenReplace<T>(T t)
        {
            Console.WriteLine("in RunWrapStatGenActionStatGenReplace<T>(T t)!" + t.ToString());
        }


        public void RunWrapInstActionInstReplace(TestEntity entity)
        {
            Console.WriteLine("in RunWrapInstActionInstReplace:" + entity.Id);
        }

        public void RunWrapInstGenActionInstGenReplace<T>(T entity)
        {
            Console.WriteLine("in RunWrapInstGenActionInstGenReplace:" + entity);
        }

        public string RunWrapInstFuncInstReplace(TestEntity t2)
        {
            Console.WriteLine("in RunWrapInstFuncInstReplace!" + t2.ToString());
            return t2.ToString();
        }

        public static string RunWrapStatFuncStatReplace(TestEntity t2)
        {
            Console.WriteLine("in RunWrapStatFuncStatReplace!" + t2.ToString());
            return t2.ToString();
        }

        public string RunGetMulParam(int a, float b, string c, double d, decimal e, short f)
        {
            return a.ToString() + b + c + d + e + f;
        }

 
        public outT RunWrapInstGenFuncInstGenReplace<InT, outT>(InT t2)
        {
            Console.WriteLine("in RunWrapInstGenFuncInstGenReplace!" + t2.ToString());
            return default(outT);
        }



        public override void VirtualTest()
        {
            Console.WriteLine("in TestsWrap.VirtualTest!");
            base.VirtualCallBases();
        }

        public override void VirtualCallBases()
        {
            Console.WriteLine("in TestsWrap.VirtualCallBase");
        }


        public override void VirtualCallVirtual()
        {
            Console.WriteLine("in TestsWrap.VirtualCallVirtuals");
        }


    }

    public class TestEntity
    {
        public string Name
        { get; set; }

        public int Id
        { get; set; }
    }
}
